#include <iostream>
#include <vector>
using namespace std;
#define endl '\n'

void solve(vector<vector<int>>&vv)
{
    vector<vector<int>> dp(6,vector<int>(6));
    for(int i = 4;i>=1;--i)
    {
        for(int j = 1;j<=4;++j)
        {
            dp[i][j] = min(dp[i+1][j+1],dp[i+1][j])+vv[i][j];
        }
    }
    cout<<"solve:"<<endl;
    cout<<dp[1][1]<<endl;
}

int main()
{
    vector<vector<int>> vv(5,vector<int>(5));
    //seting
    vv[1][1] = 45;vv[2][1] = 20;vv[2][2] = 33;vv[3][1] = 34;vv[3][2] = 18;
    vv[3][3] = 30;vv[4][1] = 14;vv[4][2] = 45;vv[4][3] = 9;vv[4][4] = 11;
    for(int i = 1;i<=4;++i)
    {
        for(int j = 1;j<=i;++j)
        {
            cout<<vv[i][j]<<' ';
        }
        cout<<endl;
    }
    solve(vv);
    return 0;
}
